package com.study.exception;

import com.study.constant.CommonKeys;

/**
 * @author CSDN 流放深圳
 * @description 自定义运行时异常
 * @create 2024-04-13 15:55
 * @since 1.0.0
 */
public class LicenceRuntimeException extends RuntimeException {

    /**
     * 返回码
     */
    private int code;

    /**
     * 返回的消息
     */
    private String message;

    /**
     * 返回的额外数据
     */
    private Object data;


    /**
     * 无参构造函数
     */
    public LicenceRuntimeException() {
        this(CommonKeys.ERROR_CODE, CommonKeys.ERROR_MSG, "");
    }

    /**
     * 抛出自定义异常消息
     *
     * @param message
     */
    public LicenceRuntimeException(String message) {
        this(CommonKeys.ERROR_CODE, message, "");
    }


    /**
     * 全参构造函数
     *
     * @param code
     * @param message
     * @param data
     */
    public LicenceRuntimeException(int code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}